import { createApp } from 'vue'
import App from './App.vue'
import { router } from '../router/index'
import axios from 'axios'
import store from '../store/store'
import Vant from 'vant'
import 'vant/lib/index.css';
import '../src/assets/iconfont.css'
import { getstorage } from '../utils/local'
import { useStore } from 'vuex'
import plugins from '../plugins'
// require styles

import MateChat from '@matechat/core';
import '@devui-design/icons/icomoon/devui-icon.css';

const stores = useStore()
// import vant from '../utils/vant'
axios.defaults.baseURL = 'http://127.0.0.1:8000/';




router.beforeEach((to, from, next) => {
    if (to.path === '/home') next()
    if (to.path === '/register') next()
    if (getstorage('userinfo') == null) next('home')
    next()
})


const app = createApp(App)
app.config.globalProperties.$http = axios
createApp(App).use(router).use(MateChat).use(store).use(Vant).use(plugins).mount('#app')
